// Decompiled by DJ v3.9.9.91 Copyright 2005 Atanas Neshkov  Date: 2008-9-8 21:59:28
// Home Page : http://members.fortunecity.com/neshkov/dj.html  - Check often for new version!
// Decompiler options: packimports(3) 
// Source File Name:   t_user_role_EditMap.java

package com.creawor.hz_market.t_user_role;

import com.creawor.imei.base.AbsEditMap;
import net.sf.hibernate.HibernateException;
import net.sf.hibernate.Session;

// Referenced classes of package com.creawor.hz_market.t_user_role:
//            t_user_role, t_user_role_Form

public class t_user_role_EditMap extends AbsEditMap
{

    public t_user_role_EditMap()
    {
    }

    public void add(t_user_role_Form vo)
        throws HibernateException
    {
        t_user_role po = new t_user_role();
        try
        {
            po.setUser_id(Integer.parseInt(vo.getUser_id()));
        }
        catch(Exception e)
        {
            e.printStackTrace();
        }
        try
        {
            po.setRole_id(Integer.parseInt(vo.getRole_id()));
        }
        catch(Exception e)
        {
            e.printStackTrace();
        }
        Session session = beginTransaction();
        try
        {
            session.save(po);
            endTransaction(true);
        }
        catch(Exception e)
        {
            endTransaction(false);
            e.printStackTrace();
            throw new HibernateException(e);
        }
    }

    public void delete(t_user_role_Form vo)
        throws HibernateException
    {
        delete(new t_user_role(Integer.parseInt(vo.getRole_id()), Integer.parseInt(vo.getUser_id())));
    }

    public void delete(t_user_role id)
        throws HibernateException
    {
        Session session = beginTransaction();
        try
        {
            session.delete(id);
            endTransaction(true);
        }
        catch(HibernateException e)
        {
            e.printStackTrace();
            endTransaction(false);
        }
    }

    public void update(t_user_role_Form vo)
        throws HibernateException
    {
        throw new UnsupportedOperationException();
    }
}